class EightQueensTask:
    def run(self):
        result = []
        self.run_inner([0, 1, 2, 3, 4, 5, 6, 7], 0, result)
        return result

    def run_inner(self, item_list, index, result):
        if index == len(item_list) - 1:
            if self.check(item_list):
                result.append(item_list + [])
        else:
            for i in range(index, len(item_list)):
                item_list[index], item_list[i] = item_list[i], item_list[index]
                self.run_inner(item_list, index + 1, result)
                item_list[index], item_list[i] = item_list[i], item_list[index]

    def check(self, item_list):
        n = len(item_list)
        for i in range(n):
            for j in range(n):
                if i == j:
                    continue
                if item_list[j] - item_list[i] == j - i:
                    return False
        return True
